package com.feng.gaoerfu.holder;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.feng.gaoerfu.R;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * @time 2017/8/9 0009 20:37
 */
public class FooterViewHolder implements View.OnClickListener {
    private final Context mContext;
    private final FooterViewListener listener;
    @InjectView(R.id.iv_cancel)
    ImageView mIvCancel;
    @InjectView(R.id.iv_positive)
    ImageView mIvPositive;
    private View mFooterView;

    public FooterViewHolder(Context context, FooterViewListener listener) {
        this.mContext = context;
        this.listener = listener;
        init();
    }

    private FooterViewHolder init() {
        initView();
        initListener();
        return this;
    }

    private void initListener() {
        mIvCancel.setOnClickListener(this);
        mIvPositive.setOnClickListener(this);
    }

    private void initView() {
        mFooterView = View.inflate(mContext, R.layout.dialog_scoring_footer, null);
        ButterKnife.inject(this, mFooterView);
    }

    public View getFooterView() {
        return mFooterView;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_cancel:
                listener.cancel();
                break;
            case R.id.iv_positive:
                listener.positive();
                break;

        }
    }


    public interface FooterViewListener {
        void cancel();

        void positive();
    }
}
